﻿<sap:ActivityDesigner x:Class="Vision.Core.ActivityComponents.IO.Ftp.FtpDownloadFileDesigner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities"
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
    Collapsible="True" ExpandState="True">
    <sap:ActivityDesigner.Resources>
        <ResourceDictionary>
            <sapc:ArgumentToExpressionConverter x:Key="argumentToExpressionConverter" />

            <DataTemplate x:Key="ExpandedActivityViewTemplate">
                <StackPanel>
                    <!-- Inputs Header -->
                    <TextBlock Text="Input(s):" FontWeight="Bold" Foreground="Navy" Margin="0,0,0,10" />

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="70" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="24" />
                        </Grid.RowDefinitions>

                        <!-- ModelItem.FileName -->
                        <TextBlock Grid.Column="0" x:Uid="TextBlock_1" Text="File name:" VerticalAlignment="Top" />
                        <sapv:ExpressionTextBox Grid.Column="1"
                                MaxLines="1" Margin="7,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                                Expression="{Binding Path=ModelItem.FileName, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                                ExpressionType="{Binding Path=ModelItem.FileName.ArgumentType}"
                                OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                    </Grid>

                    <!-- Outputs Header -->
                    <TextBlock Text="Output(s):" FontWeight="Bold" Foreground="Navy" Margin="0,0,0,10" />

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="70" />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="24" />
                        </Grid.RowDefinitions>

                        <!-- ModelItem.FileData -->
                        <TextBlock Grid.Column="0" x:Uid="TextBlock_1" Text="File data:" VerticalAlignment="Top" />
                        <sapv:ExpressionTextBox Grid.Column="1"
                                MaxLines="1" Margin="7,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                                Expression="{Binding Path=ModelItem.FileData, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=Out}"
                                ExpressionType="{Binding Path=ModelItem.FileData.ArgumentType}"
                                OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}"
                                UseLocationExpression="True" />
                    </Grid>

                    <Border Margin="0,10,0,0" BorderThickness="0,0,0,3">
                        <Border.BorderBrush>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="DarkGray" Offset="0" />
                                <GradientStop Color="White" Offset="1" />
                            </LinearGradientBrush>
                        </Border.BorderBrush>
                    </Border>

                    <StackPanel Margin="0,10,0,0">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="90" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="Body argument:" VerticalAlignment="Top" Foreground="Gray" />
                            <TextBox Grid.Column="1" x:Name="bodyArgumentBox" MaxLines="1" Margin="7,0,0,0" Text="{Binding Path=ModelItem.Body.Argument.Name, Mode=TwoWay}" />
                        </Grid>
                        <sap:WorkflowItemPresenter Grid.Row="4" Grid.ColumnSpan="2" MinWidth="100" MinHeight="50" Margin="0,10"
                                x:Uid="sad:WorkflowItemPresenter_1" AutomationProperties.AutomationId="Activity"
                                IsDefaultContainer="True"
                                HintText="Drop activity here"
                                Item="{Binding Path=ModelItem.Body.Handler, Mode=TwoWay}"
                                AllowedItemType="{x:Type sa:Activity}"/>
                    </StackPanel>

                </StackPanel>
            </DataTemplate>
            <DataTemplate x:Key="CollapsedActivityViewTemplate">
                <Label Padding="0,0,0,0" FontStyle="Italic" Foreground="{x:Static SystemColors.GrayTextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center">Double-click to view</Label>
            </DataTemplate>

            <Style x:Uid="Style_1" x:Key="CollapsibleStyle" TargetType="{x:Type ContentPresenter}">
                <Setter x:Uid="Setter_1" Property="ContentTemplate" Value="{DynamicResource ExpandedActivityViewTemplate}" />
                <Style.Triggers>
                    <DataTrigger x:Uid="DataTrigger_1" Binding="{Binding Path=ShowExpanded}" Value="false">
                        <Setter x:Uid="Setter_2" Property="ContentTemplate" Value="{DynamicResource CollapsedActivityViewTemplate}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ResourceDictionary>
    </sap:ActivityDesigner.Resources>

    <ContentPresenter x:Uid="ContentPresenter_1" Style="{DynamicResource CollapsibleStyle}" Content="{Binding}" />
</sap:ActivityDesigner>
